<template>
	<view>
		<view class="c-box-nobg">
			<c-label title="图书馆列表"></c-label>
		</view>
		<view class="c-box" v-for="item in list" :key="item.id" @click="toDetail(item.id)">
			<view class="fl">
				<view class="">
					<u-image :src="$http+item.imgUrl" height="160rpx" width="230rpx" radius="20rpx"></u-image>
				</view>
				<view class="ml32">
					<h5>{{item.name}}</h5>
					<view class="fl fs24 mt8">
						<u-icon name="map"></u-icon>
						<text>{{item.address}}</text>
					</view>
					<view class="fl fs24 mt8">
						<u-icon name="clock"></u-icon>
						<text>{{item.businessHours}}</text>
					</view>
				</view>
			</view>
			<view class="fl jed" :class="item.businessState==1?'t-gr':'t-r'">
				{{item.businessState==1?'营业中':'未营业'}}
			</view>
		</view>
	</view>
</template>

<script setup>
import { ref } from 'vue';
import {onLoad} from '@dcloudio/uni-app'
import { getListAPI } from '../../api/library';
	const list = ref()
	const getList = async()=>{
		const res =await getListAPI()
		console.log(res);
		list.value =res.rows
	}
	const toDetail = (id)=>{
		uni.navigateTo({
			url:'/subpages/library/detail/detail?id='+id
		})
	}
	onLoad(()=>{
		getList()
	})
</script>

<style>

</style>
